import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';

class ConnectNetDialog extends Dialog {
  ConnectNetDialog({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var H = MediaQuery.of(context).size.height;
    return Padding(
        padding: EdgeInsets.only(top: (H-setRatio(320))*0.3),
      child: Material(
        type: MaterialType.transparency,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Container(
              width: setRatio(320),
              height: setRatio(170),
              decoration: BoxDecoration(
                color: Color(0xFFDDDDDD),
                borderRadius: BorderRadius.only(topLeft: Radius.circular(setRatio(5)), topRight: Radius.circular(setRatio(5)))
              ),
            ),
            Container(
              width: setRatio(320),
              height: setRatio(150),
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.only(bottomLeft: Radius.circular(setRatio(5)), bottomRight: Radius.circular(setRatio(5)))
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  SizedBox(height: setRatio(27),),
                  Text('点击机器【配网按键】', style: TextStyle(color: Color(0xFF000000), fontSize: setTextSp(15)),),
                  SizedBox(height: setRatio(5),),
                  Text('使机器打开摄像头，将其二维码对准摄像头', style: TextStyle(color: Color(0xFF000000), fontSize: setTextSp(15)),),
                  SizedBox(height: setRatio(15),),
                  GestureDetector(
                    onTap: ()=>Navigator.of(context).pop(),
                    child: Container(
                      width: setRatio(145),
                      height: setRatio(44),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.all(Radius.circular(setRatio(5))),
                        gradient: LinearGradient(
                          colors: [
                            Color(0xFF0386FF),
                            Color(0xFF03AAFF),
                          ],
                          begin: Alignment.topCenter,
                          end: Alignment.bottomCenter,
                        ),
                      ),
                      child: Center(
                        child: Text('知道了', style: TextStyle(color: Colors.white, fontSize: setTextSp(15)),),
                      ),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}